package matrices;

public class TestElement implements MatrixElement{
	
	public float value;
	
	public static TestElement randomElement(float lowerBound, float upperBound){
		return new TestElement(
				(float)((Math.random()*(upperBound-lowerBound)) + lowerBound)
		);
	}
	
	public static TestElement zeroVal(){
		return new TestElement(0);
	}
	
	public TestElement(float value){
		this.value = value;
	}
	
	public boolean isEqualTo(MatrixElement b){
		return (this.value == ((TestElement)b).value);
	}
	
	public MatrixElement add(MatrixElement b) {
		this.value += ((TestElement)b).value;
		return this;
	}

	public MatrixElement multiply(MatrixElement b) {
		this.value *= ((TestElement)b).value;
		return this;
	}

	public MatrixElement createNewInstance() {
		return new TestElement(this.value);
	}

	public MatrixElement zeroValue() {
		return new TestElement(0f);
	}
	
	public boolean isZeroValue(){
		return (this.value == 0);
	}
	
	public String toString(){
		return (this.value + "");
	}

	public MatrixElement subtract(MatrixElement b) {
		this.value -= (((TestElement)b).value);
		return this;
	}
	
	public boolean isCompatibleWith(MatrixElement b) {
		return (this.getClass() == b.getClass());
	}

	public MatrixElement unityValue() {
		return new TestElement(1);
	}

	public boolean isUnityValue() {
		return (this.value == 1);
	}

	public MatrixElement invert() {
		this.value = 1.0f/this.value;
		return this;
	}	
}
